<template>
  <div>
    <Myheader
      title="兰总的小卖部"
      backgroundColor="orange"
      color="red"
    ></Myheader>
    <div id="main">
      <MyGoods :arr="obj" v-for="obj in list" :key="obj.id"></MyGoods>
    </div>
    <MyFooter :arr="list"></MyFooter>
  </div>
</template>

<script>
import axios from "axios";
import Myheader from "./components/MyHeder";
import MyFooter from "./components/MyFooter";
// import MyFooter from "./components/MyFooter";
import MyGoods from "./components/MyGoods";
export default {
  data() {
    return {
      list: [],
    };
  },
  components: {
    Myheader,
    MyFooter,
    MyGoods,
  },
  created() {
    // axios 请求
    axios({
      url: "https://www.escook.cn/api/cart",
    }).then((res) => {
      console.log(res.data.list);
      this.list = res.data.list;
    });
  },
};
</script>

<style scoped>
#main {
  padding: 45px 0 50px 0;
}
</style>